package com.example.ui.dto;

import lombok.Builder;
import lombok.Data;

/**
 * @author yliu
 */
@Data
@Builder
public class Result {
    private Integer code;
    private Object data;

    public static Result ok() {
        return builder().code(0).data("操作成功").build();
    }

    public static Result ok(String message) {
        return builder().code(0).data(message).build();
    }

    public static Result fail(String message) {
        return builder().code(-1).data(message).build();
    }

    public static Result fail(Integer code, String message) {
        return builder().code(code).data(message).build();
    }

}
